export default class SceneStatic {
  static getSceneList() {
    var sceneList = [];
    for (let i = 0; i < sceneList.length; i++) {
      const element = sceneList[i];
      sceneList[i] = element.replace(".scene", ".json");
    }
    return sceneList;
  }
  static oldScene: string;
  static selectScene: string;
  /**
   * 打开新页面
   */
  static open(
    url: string,
    closeOther?: boolean,
    param?: any,
    complete?: laya.utils.Handler,
    progress?: laya.utils.Handler
  ): void {
    if (this.oldScene == null) {
      this.oldScene = url;
      this.selectScene = url;
    } else if (this.oldScene == this.selectScene) {
      this.selectScene = url;
    } else {
      this.oldScene = this.selectScene;
      this.selectScene = url;
    }
    Laya.Scene.open(url, closeOther, param, complete, progress);
  }
  /**
   *  返回上一页
   */
  static back(
    closeOther?: boolean,
    param?: any,
    complete?: laya.utils.Handler,
    progress?: laya.utils.Handler
  ) {
    this.open(this.oldScene, closeOther, param, complete, progress);
  }
}
